<!--
 * @Author: zhangweinan
 * @Date: 2023-03-03 15:38:27
 * @LastEditors: zhangweinan
 * @LastEditTime: 2023-03-03 15:55:25
 * @Description: file content
 * @FilePath: \front-end-of-task-center\src\views\formShow\index.vue
-->
<template>
  <div>
    <parser :key="new Date().getTime()" :form-conf="detailForm" />
  </div>
</template>
<script>
import { getFormBpm } from "@/api/login";
import { decodeFields } from "@/utils/formGenerator";
import Parser from "@/components/parser";
export default {
  components: {
    Parser,
  },
  data() {
    return {
      detailForm: {
        fields: [],
      },
      formId: "",
    };
  },
  mounted() {
    this.formId = this.$route.query.id;
    getFormBpm(this.formId).then((response) => {
      // 设置值
      const data = response.data;
      this.detailForm = {
        ...JSON.parse(data.conf),
        fields: decodeFields(data.fields),
      };
    });
  },
};
</script>
